home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / include / linux / icmpv6.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-09  |  3.7 KB  |  164 lines

  1. #ifndef _LINUX_ICMPV6_H
  2. #define _LINUX_ICMPV6_H
  3.  
  4. #include <asm/byteorder.h>
  5.  
  6. struct icmp6hdr {
  7.  
  8.     __u8        icmp6_type;
  9.     __u8        icmp6_code;
  10.     __sum16        icmp6_cksum;
  11.  
  12.  
  13.     union {
  14.         __be32            un_data32[1];
  15.         __be16            un_data16[2];
  16.         __u8            un_data8[4];
  17.  
  18.         struct icmpv6_echo {
  19.             __be16        identifier;
  20.             __be16        sequence;
  21.         } u_echo;
  22.  
  23.                 struct icmpv6_nd_advt {
  24. #if defined(__LITTLE_ENDIAN_BITFIELD)
  25.                         __u32        reserved:5,
  26.                                 override:1,
  27.                                 solicited:1,
  28.                                 router:1,
  29.                     reserved2:24;
  30. #elif defined(__BIG_ENDIAN_BITFIELD)
  31.                         __u32        router:1,
  32.                     solicited:1,
  33.                                 override:1,
  34.                                 reserved:29;
  35. #else
  36. #error    "Please fix <asm/byteorder.h>"
  37. #endif                        
  38.                 } u_nd_advt;
  39.  
  40.                 struct icmpv6_nd_ra {
  41.             __u8        hop_limit;
  42. #if defined(__LITTLE_ENDIAN_BITFIELD)
  43.             __u8        reserved:3,
  44.                     router_pref:2,
  45.                     home_agent:1,
  46.                     other:1,
  47.                     managed:1;
  48.  
  49. #elif defined(__BIG_ENDIAN_BITFIELD)
  50.             __u8        managed:1,
  51.                     other:1,
  52.                     home_agent:1,
  53.                     router_pref:2,
  54.                     reserved:3;
  55. #else
  56. #error    "Please fix <asm/byteorder.h>"
  57. #endif
  58.             __be16        rt_lifetime;
  59.                 } u_nd_ra;
  60.  
  61.     } icmp6_dataun;
  62.  
  63. #define icmp6_identifier    icmp6_dataun.u_echo.identifier
  64. #define icmp6_sequence        icmp6_dataun.u_echo.sequence
  65. #define icmp6_pointer        icmp6_dataun.un_data32[0]
  66. #define icmp6_mtu        icmp6_dataun.un_data32[0]
  67. #define icmp6_unused        icmp6_dataun.un_data32[0]
  68. #define icmp6_maxdelay        icmp6_dataun.un_data16[0]
  69. #define icmp6_router        icmp6_dataun.u_nd_advt.router
  70. #define icmp6_solicited        icmp6_dataun.u_nd_advt.solicited
  71. #define icmp6_override        icmp6_dataun.u_nd_advt.override
  72. #define icmp6_ndiscreserved    icmp6_dataun.u_nd_advt.reserved
  73. #define icmp6_hop_limit        icmp6_dataun.u_nd_ra.hop_limit
  74. #define icmp6_addrconf_managed    icmp6_dataun.u_nd_ra.managed
  75. #define icmp6_addrconf_other    icmp6_dataun.u_nd_ra.other
  76. #define icmp6_rt_lifetime    icmp6_dataun.u_nd_ra.rt_lifetime
  77. #define icmp6_router_pref    icmp6_dataun.u_nd_ra.router_pref
  78. };
  79.  
  80.  
  81. #define ICMPV6_ROUTER_PREF_LOW        0x3
  82. #define ICMPV6_ROUTER_PREF_MEDIUM    0x0
  83. #define ICMPV6_ROUTER_PREF_HIGH        0x1
  84. #define ICMPV6_ROUTER_PREF_INVALID    0x2
  85.  
  86. #define ICMPV6_DEST_UNREACH        1
  87. #define ICMPV6_PKT_TOOBIG        2
  88. #define ICMPV6_TIME_EXCEED        3
  89. #define ICMPV6_PARAMPROB        4
  90.  
  91. #define ICMPV6_INFOMSG_MASK        0x80
  92.  
  93. #define ICMPV6_ECHO_REQUEST        128
  94. #define ICMPV6_ECHO_REPLY        129
  95. #define ICMPV6_MGM_QUERY        130
  96. #define ICMPV6_MGM_REPORT           131
  97. #define ICMPV6_MGM_REDUCTION        132
  98.  
  99. #define ICMPV6_NI_QUERY            139
  100. #define ICMPV6_NI_REPLY            140
  101.  
  102. #define ICMPV6_MLD2_REPORT        143
  103.  
  104. #define ICMPV6_DHAAD_REQUEST        144
  105. #define ICMPV6_DHAAD_REPLY        145
  106. #define ICMPV6_MOBILE_PREFIX_SOL    146
  107. #define ICMPV6_MOBILE_PREFIX_ADV    147
  108.  
  109. /*
  110.  *    Codes for Destination Unreachable
  111.  */
  112. #define ICMPV6_NOROUTE            0
  113. #define ICMPV6_ADM_PROHIBITED        1
  114. #define ICMPV6_NOT_NEIGHBOUR        2
  115. #define ICMPV6_ADDR_UNREACH        3
  116. #define ICMPV6_PORT_UNREACH        4
  117.  
  118. /*
  119.  *    Codes for Time Exceeded
  120.  */
  121. #define ICMPV6_EXC_HOPLIMIT        0
  122. #define ICMPV6_EXC_FRAGTIME        1
  123.  
  124. /*
  125.  *    Codes for Parameter Problem
  126.  */
  127. #define ICMPV6_HDR_FIELD        0
  128. #define ICMPV6_UNK_NEXTHDR        1
  129. #define ICMPV6_UNK_OPTION        2
  130.  
  131. /*
  132.  *    constants for (set|get)sockopt
  133.  */
  134.  
  135. #define ICMPV6_FILTER            1
  136.  
  137. /*
  138.  *    ICMPV6 filter
  139.  */
  140.  
  141. #define ICMPV6_FILTER_BLOCK        1
  142. #define ICMPV6_FILTER_PASS        2
  143. #define ICMPV6_FILTER_BLOCKOTHERS    3
  144. #define ICMPV6_FILTER_PASSONLY        4
  145.  
  146. struct icmp6_filter {
  147.     __u32        data[8];
  148. };
  149.  
  150. /*
  151.  *    Definitions for MLDv2
  152.  */
  153. #define MLD2_MODE_IS_INCLUDE    1
  154. #define MLD2_MODE_IS_EXCLUDE    2
  155. #define MLD2_CHANGE_TO_INCLUDE    3
  156. #define MLD2_CHANGE_TO_EXCLUDE    4
  157. #define MLD2_ALLOW_NEW_SOURCES    5
  158. #define MLD2_BLOCK_OLD_SOURCES    6
  159.  
  160. #define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } }
  161.  
  162.  
  163. #endif
  164.